package com.isoft.demo.service.impl;/*
 *@ClassName: FindTransferCusServiceImpl
 *@Date: 2021/6/28
 *@Author:刘逸飞
 */

import com.isoft.demo.common.ResponseData;
import com.isoft.demo.dao.FindTransferCusDao;
import com.isoft.demo.entity.Transport;
import com.isoft.demo.service.FindTransferCusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class FindTransferCusServiceImpl implements FindTransferCusService {

    @Resource
    private FindTransferCusDao dao;

    @Override
    public ResponseData findTranCus() {
        List<Transport> list= dao.findTranCus();
        ResponseData rs=new ResponseData();
        if (list !=null){
            rs.setCode(0);
            rs.setMsg("OK");
            rs.setData(list);
        }else {
            rs.setCode(1);
            rs.setMsg("Fault");
        }
        return rs;
    }

    @Override
    public ResponseData findTranCusById(int tid) {
        List<Transport> list = dao.findTranCusById(tid);
        ResponseData rs = new ResponseData();
        if(list != null){
            rs.setCode(0);
            rs.setMsg("ok");
            rs.setData(list);
        } else {
            rs.setCode(1);
            rs.setMsg("error");
        }
        return rs;
    }

    @Override
    public ResponseData confirmDate(String sdate,int tid) {
        int m = dao.confirmDate(sdate,tid);
        ResponseData rs = new ResponseData();
        if(m != 0){
            rs.setCode(0);
            rs.setMsg("确认成功！");
        } else{
            rs.setCode(1);
            rs.setMsg("确认失败!");
        }
        return rs;
    }

}
